using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Rss;
using System.IO;
using LoungrCore;



namespace Loungr
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>

    public partial class DisplayWindow : System.Windows.Window
    {
        LoungrManager loungrManager;

        public DisplayWindow()
        {

            this.Initialized += new EventHandler(DisplayWindow_Initialized);
        }

        void DisplayWindow_Initialized(object sender, EventArgs e)
        {
            loungrManager = new LoungrManager();
            loungrManager.ChangeModule += new LoungrManager.ChangeModuleDelegate(loungrManager_ChangeModule);
            loungrManager.Intialise();
        }


        void loungrManager_ChangeModule(object sender, System.Windows.Controls.UserControl module)
        {
            SubPanel.Child = module;
        }

        private void ExitClicked(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void WindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            //TODO: stop this saving to local dir

			//foreach (RssFeed f in feedManager.GetFeeds())
			//{
			//    f.Write(f.Channels[0].Title + ".feed");
			//}

			//feedManager.SaveFeeds(dataDir.FullName);
        }

    }
}